#pragma once
#ifndef _PORT_MANAGER__H
#define _PORT_MANAGER__H

#include <Theron/Theron.h>
#include "singleton.h"
#include <string>
#include "DataCenter.h"
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"

class CPortManager : public Theron::Actor
{
public:
	int m_id;
	Theron::Framework t_framwork;

	CPortManager() : Theron::Actor(t_framwork) {

	}
	explicit CPortManager(Theron::Framework &framwork) : Theron::Actor(framwork)
	{
		RegisterHandler(this, &CPortManager::handleMQTTJson);
	}

	void start();
	int setID(int id);
	int getID();

	//void handleMQTTJson(const MQTTJson& json, const Theron::Address from);
	void handleMQTTJson(const std::string& json, const Theron::Address from);
	//int send2ThreadbyID(int data, int ID);
	int sendMQTTResult2ThreadbyID(MQTTResult data, int ID);
};

#endif